const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const CommentSchema = new Schema({
  userId: { // 该字段为了关联UserSchema的主键_id
    type: String,
    required: true,
    ref: 'UserSchema', // 连表查询
  },
  bookName: {
    type: String,
    required: true,
  },
  openId: {
    type: String,
    required: true,
  },
  isbnCode: {
    type: String,
    required: true,
  },
  comment: {
    type: String,
    required: true,
  },
  createTime: {
    type: Date,
    default: Date.now,
  },
  geoLocation: String,
  phoneModel: String,
})

mongoose.model('CommentSchema', CommentSchema);